package com.bupt.liutong.admin.shop.dao;

import java.util.List;

import com.bupt.liutong.admin.core.base.Ibatis;
import com.bupt.liutong.admin.shop.dto.AttrVal;

public class AttrValDao {

	private Ibatis ibatis;

	@SuppressWarnings("unchecked")
	public List<AttrVal> getAttrValsByPage(AttrVal attrVal) {
		return (List<AttrVal>) ibatis.queryForPage("shop_attr_val.getAttrVals",
				attrVal);
	}

	public AttrVal getAttrValById(int id) {
		return (AttrVal) ibatis.queryForObject("shop_attr_val.getAttrValById",
				id);
	}

	@SuppressWarnings("unchecked")
	public List<AttrVal> getAttrValsByProdId(Integer prodId) {
		return (List<AttrVal>) ibatis.queryForList("shop_attr_val.getAttrValsByProdId",
				prodId);
	}

	public void insertAttrVal(AttrVal attrVal) {
		ibatis.insert("shop_attr_val.insertAttrVal", attrVal);
	}

	public void updateAttrVal(AttrVal attrVal) {
		ibatis.update("shop_attr_val.updateAttrVal", attrVal);
	}

	public void deleteAttrVal(int id) {
		ibatis.delete("shop_attr_val.deleteAttrVal", id);
	}

	public void deleteAttrValByProdId(int prodId) {
		ibatis.delete("shop_attr_val.deleteAttrValByProdId", prodId);
	}

	public void setIbatis(Ibatis ibatis) {
		this.ibatis = ibatis;
	}
}
